package app.controllers.admin.stat;

import app.models.member.Member;
import app.models.member.MemberIntegralRecord;
import com.github.sog.controller.BasicController;
import com.github.sog.controller.datatables.core.DatatablesCriterias;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

/**
 * <p>
 * .
 * </p>
 *
 * @author Jerry Ou
 * @version 1.0 2014-02-12 13:41
 * @since JDK 1.6
 */
public class IntegralController extends BasicController {

    public void index() {
        Member member = getModel(Member.class, "member");
        member = Member.dao.findById(member.getLong("id"));
        setAttr("member", member);
        render("index.ftl");
    }

    public void list() {
        //MemberIntegralRecord record = getModel(MemberIntegralRecord.class, "record");
        String date = getPara("date");
        Member member = getModel(Member.class, "member");
        final DatatablesCriterias criterias = getCriterias();
        Page<Record> recordPage = MemberIntegralRecord.dao.datatables(criterias, date, member);

        renderDataTables(recordPage, criterias);
    }


}
